package org.liux.android.game.jumpgame.character;

public class Line extends Shape {
	public static final int STATE_1 = 0;
	public static final int STATE_2 = 1;
	
	/**
	 *       STATE_1            STATE_2
	 *       
	 *          #                    # # # #
	 *          #                    
	 *          #                                       
	 *          #
	 *   
	 */
	
	public Line() {

	}
	@Override
	public void change(Coordinate c) {
		int x = c.x;
		int y = c.y;
		
		if (mShapeList.size() > 0) {
			mShapeList.clear();
		}
		
		if(mState == STATE_1){
			mShapeList.add(new Coordinate(x-1, y));
			mShapeList.add(new Coordinate(x, y));
			mShapeList.add(new Coordinate(x+1, y));
			mShapeList.add(new Coordinate(x+2, y));
			mOldState = mState;
			mState=STATE_2;
			return;
		}
		if(mState == STATE_2){
			mShapeList.add(new Coordinate(x+1, y));
			mShapeList.add(new Coordinate(x+1, y+1));
			mShapeList.add(new Coordinate(x+1, y+2));
			mShapeList.add(new Coordinate(x+1, y+3));
			mOldState = mState;
			mState=STATE_1;
			return;
		}
	}

	@Override
	public void initCoord() {
			mShapeList.add(new Coordinate(mMidWidth, 0));
			mShapeList.add(new Coordinate(mMidWidth, 1));
			mShapeList.add(new Coordinate(mMidWidth, 2));
			mShapeList.add(new Coordinate(mMidWidth, 3));		
		}
}
